/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ylystudio.pms.ejb.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Kenny Lin
 */
@Entity
@Table(name = "meeting")
@NamedQueries({
    @NamedQuery(name = "Meeting.findAll", query = "SELECT m FROM Meeting m"),
    @NamedQuery(name = "Meeting.findByMeetId", query = "SELECT m FROM Meeting m WHERE m.meetId = :meetId"),
    @NamedQuery(name = "Meeting.findByMeetSummaryfile", query = "SELECT m FROM Meeting m WHERE m.meetSummaryfile = :meetSummaryfile"),
    @NamedQuery(name = "Meeting.findByMeetName", query = "SELECT m FROM Meeting m WHERE m.meetName = :meetName"),
    @NamedQuery(name = "Meeting.findByMeetTitle", query = "SELECT m FROM Meeting m WHERE m.meetTitle = :meetTitle"),
    @NamedQuery(name = "Meeting.findByMeetContent", query = "SELECT m FROM Meeting m WHERE m.meetContent = :meetContent"),
    @NamedQuery(name = "Meeting.findByMeetBegin", query = "SELECT m FROM Meeting m WHERE m.meetBegin = :meetBegin"),
    @NamedQuery(name = "Meeting.findByMeetProperty", query = "SELECT m FROM Meeting m WHERE m.meetProperty = :meetProperty")})
public class Meeting implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "meet_id")
    private Integer meetId;
    @Column(name = "meet_summaryfile")
    private String meetSummaryfile;
    @Basic(optional = false)
    @Column(name = "meet_name")
    private String meetName;
    @Basic(optional = false)
    @Column(name = "meet_title")
    private String meetTitle;
    @Basic(optional = false)
    @Column(name = "meet_content")
    private String meetContent;
    @Basic(optional = false)
    @Column(name = "meet_begin")
    @Temporal(TemporalType.DATE)
    private Date meetBegin;
    @Basic(optional = false)
    @Column(name = "meet_property")
    private int meetProperty;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "meeting", fetch = FetchType.LAZY)
    private List<MeetingAttend> meetingAttendList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "meeting", fetch = FetchType.LAZY)
    private List<MeetingSummary> meetingSummaryList;
    @JoinColumn(name = "user_id", referencedColumnName = "user_id")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private User user;

    public Meeting() {
    }

    public Meeting(Integer meetId) {
        this.meetId = meetId;
    }

    public Meeting(Integer meetId, String meetName, String meetTitle, String meetContent, Date meetBegin, int meetProperty) {
        this.meetId = meetId;
        this.meetName = meetName;
        this.meetTitle = meetTitle;
        this.meetContent = meetContent;
        this.meetBegin = meetBegin;
        this.meetProperty = meetProperty;
    }

    public Integer getMeetId() {
        return meetId;
    }

    public void setMeetId(Integer meetId) {
        this.meetId = meetId;
    }

    public String getMeetSummaryfile() {
        return meetSummaryfile;
    }

    public void setMeetSummaryfile(String meetSummaryfile) {
        this.meetSummaryfile = meetSummaryfile;
    }

    public String getMeetName() {
        return meetName;
    }

    public void setMeetName(String meetName) {
        this.meetName = meetName;
    }

    public String getMeetTitle() {
        return meetTitle;
    }

    public void setMeetTitle(String meetTitle) {
        this.meetTitle = meetTitle;
    }

    public String getMeetContent() {
        return meetContent;
    }

    public void setMeetContent(String meetContent) {
        this.meetContent = meetContent;
    }

    public Date getMeetBegin() {
        return meetBegin;
    }

    public void setMeetBegin(Date meetBegin) {
        this.meetBegin = meetBegin;
    }

    public int getMeetProperty() {
        return meetProperty;
    }

    public void setMeetProperty(int meetProperty) {
        this.meetProperty = meetProperty;
    }

    public List<MeetingAttend> getMeetingAttendList() {
        return meetingAttendList;
    }

    public void setMeetingAttendList(List<MeetingAttend> meetingAttendList) {
        this.meetingAttendList = meetingAttendList;
    }

    public List<MeetingSummary> getMeetingSummaryList() {
        return meetingSummaryList;
    }

    public void setMeetingSummaryList(List<MeetingSummary> meetingSummaryList) {
        this.meetingSummaryList = meetingSummaryList;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (meetId != null ? meetId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Meeting)) {
            return false;
        }
        Meeting other = (Meeting) object;
        if ((this.meetId == null && other.meetId != null) || (this.meetId != null && !this.meetId.equals(other.meetId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ylystudio.pms.ejb.entity.Meeting[meetId=" + meetId + "]";
    }

}
